package com.lwj.liwanjia.utils;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.lwj.liwanjia.R;
import com.lwj.liwanjia.view.activity.indent.UnpaidActivity;

/**
 * Created by Administrator on 2017/9/15.
 */

public class PayCancleDialog extends Dialog implements View.OnClickListener {
    private Context context;
    private PayDialog payDialog;

    public PayCancleDialog(@NonNull Context context, PayDialog payDialog) {
        super(context, R.style.MyDialog);
        this.context = context;
        this.payDialog = payDialog;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cancle_pay_layout);
        initView();
    }

    private void initView() {
        Window window = getWindow();
        window.setGravity(Gravity.CENTER);
        window.setWindowAnimations(R.style.dialog_animation);
        setCanceledOnTouchOutside(false);
        WindowManager.LayoutParams params = window.getAttributes();
        params.width = params.WRAP_CONTENT;
        params.height = params.WRAP_CONTENT;
        window.setAttributes(params);
        TextView tvContinue = (TextView) findViewById(R.id.tv_continue);
        TextView tvLeave = (TextView) findViewById(R.id.tv_leave);
        tvContinue.setOnClickListener(this);
        tvLeave.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_continue://继续支付
                dismiss();
                break;
            case R.id.tv_leave://确认离开
                dismiss();
                payDialog.dismiss();
                break;
        }
    }
}
